<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        console.log(1);// 同步
        setTimeout(() => {
            console.log(0);//宏任务 异步
        })
        new Promise((resolve) => {
            console.log(2);// 同步
            resolve(); // 同步？
        }).then(() => {
            console.log(3);//微任务 异步
        });
        console.log(4);// 同步

    </script>

</body>

</html>